﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SWCInvoice.Enums;
using SWCInvoice.Servicelayer;

namespace SWCInvoice.Model
{
    /// <summary>
    /// Descripes a message
    /// </summary>
    public class Message : ModelBase {
        #region Fields

        /// <summary>
        /// ID of the message
        /// </summary>
        private string _id;

        /// <summary>
        /// Message typ of the message
        /// </summary>
        private MessageTyp _messageTyp;

        /// <summary>
        /// Title of the message
        /// </summary>
        private string _title;

        /// <summary>
        /// Description of the message
        /// </summary>
        private string _description;

        /// <summary>
        /// Source of the message
        /// </summary>
        private string _source;

        #endregion

        #region Properties

        /// <summary>
        /// ID of the message
        /// </summary>
        public string ID {
            get { return _id; }
        }

        /// <summary>
        /// Message typ of the message
        /// </summary>
        public MessageTyp MessageTyp {
            get {
                return _messageTyp;
            }
            set {
                if (_messageTyp == value)
                    return;
                _messageTyp = value;
                RaisePropertyChanged("MessageTyp");
            }
        }

        /// <summary>
        /// Title of the message
        /// </summary>
        public string Title {
            get {
                return _title;
            }
            set {
                if (_title == value)
                    return;
                _title = value;
                RaisePropertyChanged("Title");
            }
        }

        /// <summary>
        /// Description of the message
        /// </summary>
        public string Description {
            get {
                return _description;
            }
            set {
                if (_description == value)
                    return;
                _description = value;
                RaisePropertyChanged("Description");
            }
        }

        /// <summary>
        /// Source of the message 
        /// </summary>
        public string Source {
            get {
                return _source;
            }
            set {
                if (_source == value)
                    return;
                _source = value;
                RaisePropertyChanged("Source");
            }
        }

        #endregion

        #region Constructor

        /// <summary>
        /// Constructor of the page object
        /// </summary>
        public Message(string title, MessageTyp messageTyp = Enums.MessageTyp.None, string description = "", string source = "") {
            _id = Utilities.NewGuid();
            _title = title;
            _messageTyp = messageTyp;
            _description = description;
            _source = source;
        }

        #endregion
    }
}
